package com.football.springboot.controller;


import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.football.springboot.common.Result;
import com.football.springboot.common.Return;
import com.football.springboot.entity.*;
import com.football.springboot.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Api(tags = "数据统计管理")
@RestController
@RequestMapping("/statistics")
public class StatisticsController {
    @Resource
    private UserService userService;

    @Resource
    private ITeamService teamService;

    @Resource
    private IPlayerService playerService;

    @Resource
    private ILeagueService leagueService;

    @Resource
    private ITeamDataService teamDataService;

    @Resource
    private IPlayerDataService playerDataService;

    @Resource
    private IGameService gameService;

    @Resource
    private IGameDataService gameDataService;

    //后台管理系统：统计用户数量、联赛数量、球队数量、球员数量、比赛数量
    @ApiOperation("统计数量")
    @GetMapping("/numbers")
    public Result numbers(){
        QueryWrapper<User> queryWrapperu = new QueryWrapper<>();
        QueryWrapper<Team> queryWrappert = new QueryWrapper<>();
        QueryWrapper<Player> queryWrapperp = new QueryWrapper<>();
        QueryWrapper<League> queryWrapperl = new QueryWrapper<>();
        QueryWrapper<Game> queryWrapperg = new QueryWrapper<>();

        Long usernumbers = userService.count(queryWrapperu);
        Long teamnumbers = teamService.count(queryWrappert);
        Long playernumbers = playerService.count(queryWrapperp);
        Long leaguenumbers = leagueService.count(queryWrapperl);
        Long gamenumbers = gameService.count(queryWrapperg);

        Map numbermap = new HashMap();
        numbermap.put(1,usernumbers);
        numbermap.put(2,teamnumbers);
        numbermap.put(3,playernumbers);
        numbermap.put(4,leaguenumbers);
        numbermap.put(5,gamenumbers);

        return Result.success(numbermap);
    }




    //球队数据比较
    @ApiOperation("球队数据比较")
    @GetMapping("/front/teamcompare")
    public Result compareStatistics(){







        return Result.success();
    }



    //球员数据比较
    @ApiOperation("球员数据比较")
    @GetMapping("/front/playercompare")
    public Result playercompare(){



        return Result.success();
    }




//    //可视化分析
//    @ApiOperation("可视化分析")
//    @GetMapping("/front/visualanalysis")
//    public Result visualanalysis(){
//
//
//
//        return Result.success();
//    }




}
